/* ===================================================================
   SOUL PAWS — TESTIMONIALS (modular)
   -------------------------------------------------------------------
   Layered on top of the base .testimonial-* styles in style.css.
   Namespaced with `tst-` so the module can be moved or removed
   without side effects.
   =================================================================== */

/* Equal-height cards with the author row pinned to the bottom. */
.tst-card {
  display: flex;
  flex-direction: column;
  opacity: 0;
  animation: tst-fade-in 0.5s ease forwards;
}

@keyframes tst-fade-in {
  to {
    opacity: 1;
  }
}

.tst-card .testimonial-author {
  margin-top: auto;
  padding-top: var(--space-sm);
}

/* Base styles leave these spans inline — stack them so longer labels
   never run into each other. */
.tst-card .testimonial-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.tst-card .testimonial-info .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Reviewer avatar ---------- */
.tst-avatar {
  flex: 0 0 auto;
  overflow: hidden;
  padding: 0;
}

.tst-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.tst-avatar--fallback {
  font-size: 1.2rem;
}

/* A final page with 1 or 2 reviews keeps the card width of a full page
   and centres the group, instead of leaving a hole on the right. */
.testimonials-grid.tst-partial-2 {
  justify-content: center;
  grid-template-columns: repeat(2, minmax(0, calc((100% - 2 * var(--space-lg)) / 3)));
}

.testimonials-grid.tst-partial-1 {
  justify-content: center;
  grid-template-columns: minmax(0, calc((100% - 2 * var(--space-lg)) / 3));
}

/* ---------- Quote as a link to the original review ---------- */
.tst-quote {
  display: block;
  margin-bottom: var(--space-sm);
  color: inherit;
  text-decoration: none;
}

.tst-quote .testimonial-text {
  margin-bottom: 0.75rem;
  /* Long reviews are trimmed — the full text is one click away. */
  display: -webkit-box;
  -webkit-line-clamp: 11;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color var(--transition-base);
}

.tst-more {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--color-dusty-rose-dark);
  transition: gap var(--transition-base), color var(--transition-base);
}

.tst-quote:hover .tst-more,
.tst-quote:focus-visible .tst-more {
  gap: 0.55rem;
  color: var(--color-charcoal);
}

.tst-quote:hover .testimonial-text {
  color: var(--color-charcoal-light);
}

.tst-quote:focus-visible {
  outline: 2px solid var(--color-dusty-rose-dark);
  outline-offset: 4px;
  border-radius: var(--radius-sm);
}

/* ---------- Pagination ---------- */
.tst-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: var(--space-lg);
}

.tst-page,
.tst-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 0.5rem;
  border: 1px solid var(--color-sage-light);
  border-radius: var(--radius-circle);
  background: var(--color-white);
  color: var(--color-charcoal-light);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition-base);
}

.tst-page:hover:not([aria-current='true']),
.tst-arrow:hover:not(:disabled) {
  background: var(--color-lavender-light);
  border-color: var(--color-dusty-rose);
  color: var(--color-charcoal);
}

.tst-page[aria-current='true'] {
  background: #d4acda;
  border-color: #d4acda;
  color: var(--color-white);
  box-shadow: 0 4px 16px rgba(212, 172, 218, 0.4);
  cursor: default;
}

.tst-arrow:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.tst-page:focus-visible,
.tst-arrow:focus-visible {
  outline: 2px solid var(--color-dusty-rose-dark);
  outline-offset: 3px;
}

/* Base stylesheet collapses the grid to one column here — keep the
   partial-page rules from re-introducing multiple columns. */
@media (max-width: 768px) {
  .testimonials-grid.tst-partial-1,
  .testimonials-grid.tst-partial-2 {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tst-card {
    opacity: 1;
    animation: none;
  }
}
